package com;

import java.time.LocalDateTime;

public abstract class User {
    private String userId;
    private String username;
    private String password;
    private LocalDateTime registerTime;
    private String userType;
    private String phone;
    public User(String userId, String username, String password,
                LocalDateTime registerTime, String userType, String phone) {
        this.userId = userId;
        this.username = username;
        this.password = password;
        this.registerTime = registerTime;
        this.userType = userType;
        this.phone = phone;                                                }
    public abstract boolean login(String inputUsername, String inputPassword);
    public void logout() {
        System.out.println("已退出登录，返回主菜单");
    }
    public boolean changePassword(String oldPwd, String newPwd) {
        if (this.password.equals(oldPwd)) {
            this.password = newPwd;
            return true;                  }
        return false;                                           }
    public String getUserId() { return userId; }
    public String getUsername() { return username; }
    public String getPassword() { return password; }
    public void setPassword(String password) { this.password = password; }
    public LocalDateTime getRegisterTime() { return registerTime; }
    public String getUserType() { return userType; }
    public String getPhone() { return phone; }
    public void setPhone(String phone) { this.phone = phone; }
}